/**
* @file task_gui.c
* @brief gui scheduler
* @details for reserver
* @author huangbin
* @version V1.0.0
* @date 2025-04-20
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/
#include "inc.h"

uint8_t taskGUITaskId;
WINDOW_VAR gVar;

void NotifyGuiTask(void)
{
	osalSetEvent( taskGUITaskId, TASK_GUI_WM_PROCESS_EVT);
}
uint32_t taskGUI( uint8_t task_id, uint32_t events )
{
    // 循环处理消息队列
    if ( events & TASK_GUI_WM_PROCESS_EVT )
    {
//			MSGTYPE msg;
//			if(guiGetMessage(&msg))
//			{
//				DebugPrintf("%s,process msg,msg=0x%X\r\n",__func__,msg.type);
//				gVar.pWin(msg.type,msg.value);
//				osalSetEvent( task_id, TASK_GUI_WM_PROCESS_EVT ); //继续处理剩余事件
//			} 
			return ( events ^ TASK_GUI_WM_PROCESS_EVT );
    }	
	return ( 0 );
}

//UINT32 wndDefaultWndProcess(WPARAM wParam, LPARAM lParam)
//{
//	return 0;
//}
//extern UINT32 wndMainWndProcess(WPARAM wParam, LPARAM lParam);
void taskGUIInit( uint8_t task_id )
{
	taskGUITaskId = task_id;
//	guiSendMessageEx(MSG_CREATE,0);
//	guiSendMessageEx(MSG_PAINT,0);
//	gVar.pWin = wndDefaultWndProcess;
//    gVar.pWin = wndMainWndProcess;
	osalSetEvent( task_id, TASK_GUI_WM_PROCESS_EVT );	// 开始处理GUI消息
}
//切换窗口
void guiWndSwtich(WNDPROC newWnd)
{
//	gVar.pWin(MSG_DESTROY,0);
//	gVar.pWin = newWnd;
//	gVar.pWin(MSG_CREATE,0);
//	gVar.pWin(MSG_PAINT,0);	
//	guiMessageQueueClear();
}

//=======================================================================

